package cc.wsyw126.java.service;

import java.awt.*;
import java.awt.event.ActionEvent;

/**
 * Created by junpeng.yang on 16/8/18.
 */
public class UserActionListener {
    public void userAction(ActionListener actionListener){
        actionListener.actionPerformed("asd");
    }
    public static void main(String[] args) throws InterruptedException {

        UserActionListener userActionListener = new UserActionListener();
        userActionListener.userAction(new ActionListener() {
            @Override
            public void actionPerformed(String e) {
                System.out.println("e = " + e);
            }
        });



        userActionListener.userAction(e -> {
            System.out.println("e = " + e);
        });


        Thread thread = new Thread(() -> {
            System.out.println("Thread");
            try {
                Thread.sleep(1000*10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });

        thread.start();

        RunableImpl runable = new RunableImpl();
        Thread thread1 = new Thread(runable);
        thread1.start();
        long start = System.currentTimeMillis();
        Thread.sleep(1000*2);
        System.out.println("System.currentTimeMillis()-start = " + (System.currentTimeMillis() - start));
    }

}
class  RunableImpl implements  Runnable{

    @Override
    public void run() {
        System.out.println("IMPL");
    }
}

